import json
import logging

from config import BASE_PATH

def read_json(filename,apiname):
    filepath = BASE_PATH + '/data/' + filename +'.json'
    with open(filepath,'r',encoding='utf-8') as f:
        json_data = json.load(f)
        api_data = json_data[apiname]
        test_data = []
        for i in api_data:
            test_data.append(tuple(i.values()))
    logging.info("获取到的测试数据:{}".format(test_data))
    print("获取到的测试数据:{}".format(test_data))
    return test_data


if __name__ == '__main__':
    read_json('data_test','api1_data')